<?php 

//1.向student表中插入两条数据
1.insert into student ('','','') values ('','',''),('','','');
//2.将student表中id=10的数据：性别改为女，年龄改为30
2.update student set sex="女",age=30 where sid=10;
//3.将年纪小于30岁的同学年龄+1
3.update student set age=age+1 where age<30;
//4.删除年纪最小的同学	
4.delete from student where age asc limit 1;
//5.学生表中随机获取5条数据
5.select * from student order by rand() limit 5;

//张忙德//6.给student表添加一个time字段     int(8)
6.alter table student add time int(8) unsigned not null default 0;

//7.将username 字段修改为char(30)
7. alter table student modify username char(30) not null default '';
//8.删除学生表的主键
//直接删除主键删不了，要先删除自增，再删除主键
8.alter table student modify sid int unsigned;
alter table student drop primary key;
//9.给student表添加主键自增
//先添加主键，再修改sid类型把自增添上
9.alter table student add primary key(sid);
alter table student modify sid int unsigned auto_increment;
//10.查找姓李同学的总数
10.select count(username) from student where username like '李%';
//11.student表和class表，统计每个班有多少学生
11.select c.cname,count(*) from student as s join class as c on s.cid=c.cid group by c.cname;
//12.查找王思彤的同班同学(不包含王思彤)

12.select * from student where cid=(select cid from student where username="王思彤") and username !="王思彤";
//13.检索出【后盾网】这篇文章 有哪些标签

13.select a.aname,t.tname from article as a join art_tag as at on a.aid= at.aid join tag as t on at.tid=t.tid where a.aname='后盾网';
//14.检索出标签最多的文章(arc   arc_tag  tag)

14.select a.aname,count(*) from article as a join art_tag as at on a.aid=at.aid group by a.aname order by count(*) desc limit 1;









